import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity()
export class Message {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: 'IMEI码', nullable: true })
  imei: string;

  @Column({ comment: '设备地址' })
  deviceAddress: string;

  @Column({ comment: '数据类型' })
  dataType: string;

  @Column({ comment: '上报类型' })
  reportType: string;

  @Column({ type: 'varchar', length: 19, comment: '上报时间（东八区字符串）' })
  timestamp: string;

  @Column('text', { comment: '原始报文' })
  rawData: string;

  @Column('text', { comment: '解析内容' })
  parsedData: string;

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
}
